package com.vancouver.knows.business.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.pangu.util.StringUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Chris Li on 2016-08-24.
 */
public class FetchUserBusinessImagesHandler extends ACheckableJsonParser {

    private List<String> userBusinessImages;

    @Override
    protected void parserContent(JSONObject content) throws Exception {
        String images = content.getString("images_array");
        if (StringUtil.isEmptyString(images)) {
            userBusinessImages = new ArrayList<>();
        } else {
            userBusinessImages = JSON.parseArray(images, String.class);
        }

        int totalCount = content.getInteger("total_count");
        if (pageInfo != null) {
            pageInfo.setTotalCount(totalCount);
        }
    }

    public List<String> getUserBusinessImages() {
        return userBusinessImages;
    }
}
